package com.tencent.mapper;

import com.tencent.entity.Diet;
import lombok.Data;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: Fame
 * @date: 2022-08-30 15:17
 * @description: 查询膳食
 */
public interface DietMapper {

    @Results(id = "diet", value = {
            @Result(property = "id",column = "t_id"),
            @Result(property = "food",column = "t_food"),
            @Result(property = "serving",column = "t_serving"),
            @Result(property = "intake",column = "t_intake"),
            @Result(property = "level",column = "t_level"),
    })
    @Select("select * from t_diet")
    public List<Diet> getAll();

    @Select("select * from t_diet where t_level = #{level}")
    @ResultMap(value = "diet")
    public List<Diet> getByLevel(String level);
}
